<template>
  <div>
    <transition name="fade" mode="out-in">
      <keep-alive :include="pages">
        <component :is="currentView"></component>
      </keep-alive>
    </transition>
  </div>
</template>

<script>
  import CostConfirm from './costConfirm'
  import CostAuditing from './costAuditing'
  import CostReview from './costReview'
  import CostSend from './costSend'
  import CostCollision from './costCollision'

  // 0-监管科 confirm
  // 1-区 auditing
  // 2-市 review
  // 3-送审 send
  const map = {
    confirm: 0,
    auditing: 1,
    review: 2,
    send: 3,
    collision: 4,
  }

  export default {
    name: 'chkCost',
    data() {
      return {
        views: ['CostConfirm', 'CostAuditing', 'CostReview', 'CostSend', 'CostCollision'],
        pages: ['costConfirm', 'costAuditing', 'costReview', 'costSend', 'costCollision']
      }
    },
    computed: {
      currentView() {
        return this.views[map[this.$route.meta.code]]
      }
    },
    created(){
//      console.log(this.$route.meta.code)
    },
    methods: {
      back() {
        this.changeView(this.$route.meta.code)
      }
    },
    components: {
      CostConfirm,
      CostAuditing,
      CostReview,
      CostSend,
      CostCollision
    }
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" rel="stylesheet/scss" type="text/scss">

</style>
